草庐IT

C++ : has_trivial_X type traits

全部标签

c++ - 警告 : auto-importing has been activated without --enable-auto-import specified on the command line

我的环境:QtCreator2.3.1Qt4.7.4(32位)Windows7旗舰版(64位)尝试在QtforWindows中重建项目时,我遇到以下编译器警告:warning:auto-importinghasbeenactivatedwithout--enable-auto-importspecifiedonthecommandline.Thisshouldworkunlessitinvolvesconstantdatastructuresreferencingsymbolsfromauto-importedDLLs.发出此警告的项目包含一个DLL文件。尽管有警告,DLL中的类和函数

C++ 编译器错误 "cannot be thread-local because it has non-POD type”“

这个声明:___threadAa;生成此错误:cannotbethread-localbecauseithasnon-PODtypeA在哪里classA{public://functiondeclarationprivate://datamembers};我正在尝试使用命令ogsincludes&ogsmk在Linux上进行编译。我们有静态线程,即在我们的应用程序进入之前,我们知道线程的数量,因此目前的工作是通过声明A的数组来完成的,即Aa[Numberofthreads].我该如何解决这个问题? 最佳答案 假设您使用gcc,线程本

c++ - 增量构建 : Eclipse CDT does not notice that source has changed

在EclipseCDT中点击“构建”符号时,应该只构建已更改的源文件。EclipseCDT的一个非常恼人的行为是它经常忽略已进行的“微小”更改,但并不清楚微小的含义。然后输出是13:21:06****IncrementalBuildofconfigurationforproject****makeallmake:Nothingtobedonefor`all'.我测试刚刚所做的更改的唯一方法是清理并完全重建整个项目,这会浪费很多时间。这可能是什么问题,我该如何修复增量构建?编辑:会不会因为一些时钟同步问题而忽略了最近发生的变化? 最佳答案

c++ - 谁放狗出来的? - 当 "Is-A"在类层次结构中遇到 "Has-A"时对象销毁

考虑一下:classFluffyThing{public:FluffyThing(){m_pMyFur=newFur;}virtual~FluffyThing();protected:Fur*m_pMyFur;};classClawedFluffyThing:publicFluffyThing{public:ClawedFluffyThing():FluffyThing(){m_pMyClaws=newClaws;}virtual~ClawedFluffyThing();protected:Claws*m_pMyClaws;};classScaryFluffyThing:publicC

c++ - std::is_trivially_equality_comparable_v<T>

相关但比C++11staticassertforequalitycomparabletype?神秘得多—JFBastien的论文N4130"PadThyAtomics!"让我想到如果我们要使用atomic::compare_exchange_weak()其中T是类或者结构类型,比如structCount{intstrong_count;intweak_count;};然后我们真的想静态断言两件事:首先,T实际上是无锁原子的:templatestaticconstexprboolis_lockfree_atomic_v=std::atomic::is_always_lock_free;其

c++ - boost static_vector 而不是 std::is_trivially_destructible

根据thisexample(左例)#include#includestructX{intk;std::arraya;boost::container::static_vectorb;~X()=default;};inthuh(){std::arrayx;return0;}看起来像boost::container::static_vector当T时可以轻易破坏是(当b被销毁时,不会在X上循环)。huh优化为xoreax,eax;ret(即return0不遍历数组。当我改用具有非平凡析构函数的包含类型时(右例)#include#includestructY{~Y();};structX{i

c++ - 使用 -g 选项编译但 "Single stepping until exit from function main, which has no line number information"

我在使用gdb时遇到了一些问题。这是我在一个名为main.cpp的文件中的代码#includevoidmyfunc();intmain(){charmsg[]="HelloWorld!";myfunc();std::cout我使用这个命令来编译这段代码:g++-g-Wallmain.cpp-ofoo接下来,我使用了gdb:$gdbfoo(gdb)startTemporarybreakpoint1at0x80487c3Startingprogram:/home/laptop/workspace/fooTemporarybreakpoint1,0x080487c3inmain()(gdb)

c++ - 错误 : Element <EnableEnhancedInstructionSet> has an invalid value of "NoExtensions"

我想在虚拟机WindowsXP下VS2010下打开别人的C++项目。问题是,我认为该项目似乎是在Windows7下的VS2012下开发的。我已经成功转换了它的相关配置,感谢互联网。但是现在,当我尝试构建这个项目时,出现了以下错误:C:\ProgramFiles\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(147,5):error:Elementhasaninvalidvalueof"NoExtensions".似乎配置更改导致了这个问题。我所做的是将Project->Properties-

NVIDIA-SMI has failed because it couldn‘t communicate with the NVIDIA driver解决办法

NVIDIA-SMIhasfailedbecauseitcouldn‘tcommunicatewiththeNVIDIAdriver解决办法参考链接1参考链接2参考链接32023.3.17更新今天突然又出现这个问题,一开始我就以为内核自动更新,便想去降低内核版本,一看旧版本的内核,发现都被自动删除了,然后我之前也将内核自动更新取消了啊,输入命令dpkg--get-selections|greplinux-image打印内核版本显示也是hold,按道理内核并没有更新。一开始没发现问题,便一直尝试下载旧版本内核来解决,一直没成功。最后无意间在ubuntu的应用中点开nvidiaxserverset

c++ - free.c 抛出异常 "this program has stopped working"

当我使用VisualC++2010Express的调试器运行程序(server.exe)时,它运行完美,但是当我将它作为exe运行时它却没有;它崩溃并显示“Server.exe已停止工作”对话框。接下来我将exe重命名为“ServerInstaller.exe”并且它工作了,所以我认为这是一个权限错误,但它不适用于管理员模式下的“Server.exe”。然后我将VC++中的调试器附加到“Server.exe”程序,它在“free.c”中出现异常。这个文件中的代码是void__cdecl_free_base(void*pBlock){intretval=0;if(pBlock==NULL